;
(function() {
    new Vue({
        el: '#feedback',
        data: {
            flag: true,
            orders: '#',
            columns: 'CT',
            pagetotal: 0,
            page: 1,
            limit: ['10'],
            pageCounts: [{name: '10', code: '10'}, {name: '15', code: '15'}, {name: '20', code: '20'}],
            typelist: [],
            typeStatus: '',
            keyword: '',
            publishingType: '#',
            moduleId: '#',
            data: [],
			modulesList: [],
			moduleCode: [],
            erweimaflag: false,
            quanxian: JSON.parse(window.localStorage.getItem('permissions')),
        },
        filters: {
            framtTime(time) {
                return hlDateUtil.formatDate(time, 'yyyy-MM-dd HH:mm:ss')
            },
            formatDate: function(time) {
                if (time === undefined) return '--'
                return hlDateUtil.formatUTCDate(time, 'yyyy-MM-dd')
            },
        },
        methods: {
            //显示隐藏查询条件
            showHideTerm() {
                this.flag = !this.flag;
            },
            // 设置背景色
            addbgcolor(index) {
                let el = document.querySelectorAll('.house-two-tone');
                let el0 = document.querySelectorAll('.house-operate')
                el[index].classList.add('house-two-tone-hover')
                el0[index].classList.add('house-two-tone-hover')
            },
            //删除背景色
            removebgcolor(index) {
                let el = document.querySelectorAll('.house-two-tone');
                let el0 = document.querySelectorAll('.house-operate')
                el[index].classList.remove('house-two-tone-hover')
                el0[index].classList.remove('house-two-tone-hover')
            },
            //创建时间
            createTime() {
                setTimeout(() => {
                    this.getListData();
                }, 300)
                this.orders = this.orders == '#'?'A':(this.orders == 'A'?'D':'A')
            },
            //展示数量
            eventPage(arr) {
                this.limit = [arr[0].code];
                this.getListData()
            },
            //重置
            reset() {
                this.keyword = '';
                this.moduleId = '#';
                this.orders = '#';
                this.page = 1;
                this.limit = ['10'];
				this.moduleCode = [];
                this.getListData()
            },
			//获取模块
			moduleDt () {
				hlhttp.get({
				  url: 'configure/dict',
				  data: {module_code: 'CSTM_JWK', config_name: 'CSTM_JWK_PARK_SERVICE_TYPE'},
				  success: (data) => {
				    this.modulesList = hlArrayUtil.replaceData(data, [{key: 'dictName', rKey: 'name'}, {key: 'dictCode', rKey: 'code'}]);
				  }
				})
			},
			//模块
			eventModule (arr) {
				this.moduleCode = [arr[0].code];
			},
            //查询
            search(){
                this.page = 1
                this.limit = ['10'];
                this.getListData();
            },
            //获取反馈列表
            getListData() {
                hlhttp.get({
                    url: 'jwk/park_service_feedbacks',
                    data:{
                        'keyword': this.keyword || '#',
                        "order": this.orders,
                        "column": this.columns,
                        "page": this.page,
                        "page_count": this.limit[0],
						service_module: this.moduleCode.length ? this.moduleCode[0] : '#'
                    },
                    success: (data) => {
                        this.data = data;
                        $("#page").initPage(data.totalPage, this.page, (n) => {
                            if (this.page == n) {
                                return
                            }
                            this.page = n;
                            this.getListData();
                        });
                    }
                })
            },
            //删除当前反馈
            delItem(id){
                hllayer.confirm('确认要删除该反馈吗?', () => {
                    var that = this
                    hlhttp.delete({
                        url: 'jwk/park_service_feedback?feedback_id='+id,
                        data: {
                            feedback_id: id
                        },
                        success: (data) => {
                            hl.toast('删除成功')
                            that.getListData()
                        }
                    })
                })

            },
        },
        created() {
            hlSelectUi()
        },
        mounted() {
            this.getListData()
			this.moduleDt()
        }
    })
}())
